﻿using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Dapper.SqlMapper;

namespace Publicuse.Interface
{
    public interface IMySqlDapperService : IBaseService
    {
        public long Insert<T>(T entity, out string msg) where T : class, new();

        public long Insert(string sql, DynamicParameters parameters, out string msg);

        public IEnumerable<T> Insert<T>(List<T> entitys, out string msg) where T : class, new();

        public bool Update<T>(T entity, out string msg) where T : class, new();

        public T Update<T>(List<T> entitys, out string msg) where T : class, new();

        public bool Delete<T>(long id, out string msg) where T : class, new();

        public bool Delete<T>(List<string> ids, out string msg) where T : class, new();

        public List<T> Query<T>(string sql, out string msg) where T : class, new();

        public List<T> GetAll<T>(out string msg) where T : class, new();

        public T QueryFirst<T>(string sql, out string msg) where T : class, new();

        public List<T> Query<T>(string sql, object param, out string msg) where T : class, new();

        public bool ExecuteSql(string sql, object param, out string msg);

        public DataTable GetDataTable(string sql, object param, out string msg);

        public DataSet GetDataSet(string sql, object param, out string msg);

        public void Query(string sql, object param, out string msg, Action<IDbConnection> action);

        public void QueryMultiple(string sql, object param, out string msg, Action<GridReader> action);
    }
}
